﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Page/MasterPage.master" AutoEventWireup="true"
    CodeFile="ManageCategory.aspx.cs" Inherits="Page_ManageCategory" %>

<%@ Register Src="UserControl/ContentHeader.ascx" TagName="ContentHeader" TagPrefix="uc1" %>
<%@ Register Src="UserControl/Message.ascx" TagName="Message" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <uc1:ContentHeader PageTitle="Manage category" GoToLabel="Add new category" GoToLink="AddNewCategory.aspx"
        ID="ContentHeader1" runat="server" />
    <uc2:Message ID="Message1" runat="server" />
    <div class="body_content">
        <uc2:Message ID="Message_Alert" runat="server" />
        <asp:UpdateProgress ID="UpdateProgress_Main" AssociatedUpdatePanelID="UpdatePanelContent"
            runat="server" DynamicLayout="true" DisplayAfter="0">
            <ProgressTemplate>
                <div class="overlay">
                    <div class="loader">
                        <img id="Img1" runat="server" alt="Loading..." src="../App_Themes/img_data/loading.gif"
                            width="25" />
                    </div>
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UpdatePanelContent" runat="server" OnLoad="UpdatePanelContent_Load">
            <ContentTemplate>
                <table width="100%" cellspacing="0" cellpadding="0" class="df_table">
                    <tr>
                        <th>
                            Category
                        </th>
                        <th style="width: 6%" class="center">
                        </th>
                    </tr>
                    <asp:Repeater runat="server" ID="Repeater_Content" OnItemCommand="Repeater_Content_ItemCommand"
                        OnItemDataBound="Repeater_Content_ItemDataBound">
                        <ItemTemplate>
                            <tr class="<%# Container.ItemIndex % 2 == 0 ? "odd" : "even" %>">
                                <td>
                                    <asp:Literal ID="Literal_CategoryName" runat="server" Text='<%# Eval("Value")%>'></asp:Literal>
                                    <asp:TextBox Visible="false" CssClass="textbox_small" ValidationGroup="input" ID="TextBox_Name"
                                        Text='<%# Name(Eval("Value")) %>' runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator_Valid" ValidationGroup="input"
                                        runat="server" ControlToValidate="TextBox_Name" ErrorMessage="*"></asp:RequiredFieldValidator>
                                </td>
                                <td class="center">
                                    <asp:LinkButton runat="server" ID="LinkButton_Edit" ToolTip="Edit" CommandName="Edit"
                                        CssClass="edit_icon" CausesValidation="false"></asp:LinkButton>
                                    <asp:LinkButton runat="server" ID="LinkButton_Save" CommandArgument='<%# Eval("Key") %>'
                                        ToolTip="Save change" ValidationGroup="input" CausesValidation="true" CommandName="Update"
                                        CssClass="save_icon" Visible="false"></asp:LinkButton>
                                    <asp:LinkButton runat="server" ID="LinkButton_Cancel" ToolTip="Cancel" CommandName="Cancel"
                                        CssClass="cancel_icon" CausesValidation="false" Visible="false"></asp:LinkButton>
                                    <asp:LinkButton runat="server" ID="LinkButton_Delete" ToolTip="Delete" CommandName="DeleteCommand"
                                        CssClass="del_icon" CausesValidation="false" CommandArgument='<%# Eval("Key") %>'
                                        OnClientClick='return ConfirmAction("Are you sure you want to permanently delete the selected item?");'></asp:LinkButton>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                    <tr runat="server" id="tr_not_found" visible="false">
                        <td colspan="6">
                            Data not found.
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <script type="text/javascript">
        function loadpage(page) {
            __doPostBack('<%= UpdatePanelContent.ClientID %>', page + '|page');
        }
        function ConfirmAction(message) {
            return confirm(message);
        }
    </script>
</asp:Content>
